#include "cmsis_os2.h"
#include "oled.h"

/* 命令消息队列, 目前的命令只是拨码键盘的编号 */
extern osMessageQueueId_t CtrlDispQueueHandle;

/**
 * @brief OLED显示任务
 * 
 * @param argument 未使用 
 */
void _DispTask(void *argument)
{
    UNUSED(argument);
    uint8_t mode;
    uint8_t last_mode = 0xFF; 
    OLED_Init();
    for (;;)
    {
        osMessageQueueGet(CtrlDispQueueHandle, &mode, NULL, osWaitForever);
        /* 接收显示命令并执行不同的显示任务 */
        if (mode != last_mode)
        {
            OLED_CLR();
            switch (mode)
            {
                case 0:  OLED_DispString(1, 8-7/2, "0 Shoot"); break;
                case 1:  OLED_DispString(1, 8-7/2, "1 Fetch"); break;
                case 2:  OLED_DispString(1, 8-7/2, "2 Debug"); break;
                case 3:  OLED_DispString(1, 8-7/2, "3 Hello"); break;
                default: OLED_DispString(1, 8-7/2, "!Error!"); break;
            }
            last_mode = mode;
        }
    }
}